import json
import os

version = "0.3"


def updateConfig(newConfig=0):
    if newConfig != 0:
        with open("config.json", "w", encoding="utf-8") as configFile:
            config.update(newConfig)
            json.dump(config, configFile)
        return newConfig
    else:
        try:
            with open("config.json", "r+", encoding="utf-8") as configFile:
                config = json.load(configFile)
        except FileNotFoundError:
            with open("config.json", "w", encoding="utf-8") as configFile:
                json.dump({"showDisclaimer": True}, configFile)
            with open("config.json", "r+", encoding="utf-8") as configFile:
                config = json.load(configFile)
        return config


config = updateConfig()
